package com.example.last.controller;

import com.example.last.common.Result;
import com.example.last.entity.PaperQuestions;
import com.example.last.service.PaperQuestionsService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

;

@CrossOrigin
@RequestMapping("peparQuestions")
@RestController
public class PaperQuestionsController {
    @Resource
    private PaperQuestionsService paperQuestionsService;
    @PostMapping
    public Result save(@RequestBody PaperQuestions paperQuestions){
        if(paperQuestions.getId() == null){
            paperQuestionsService.add(paperQuestions);
        }else{
            paperQuestionsService.update(paperQuestions);
        }
        return Result.success();
    }

    //删除图书信息
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id){
        paperQuestionsService.delete(id);
        return Result.success();
    }



}
